package com.fuhaiwei.basic.utils.impl;

import java.text.MessageFormat;
import java.util.ResourceBundle;

import com.fuhaiwei.basic.utils.TextUtils;

public class TextUtilsImpl implements TextUtils {

	private ResourceBundle resourceBundle;

	public String label(String fieldName) {
		return text("label_" + fieldName);
	}

	public String text(String key) {
		return resourceBundle.getString(key);
	}

	public String text(String key, Object... objects) {
		return MessageFormat.format(resourceBundle.getString(key), objects);
	}

	public ResourceBundle getResourceBundle() {
		return resourceBundle;
	}

	public void setResourceBundle(ResourceBundle resourceBundle) {
		this.resourceBundle = resourceBundle;
	}

}
